package com.dinadi.yidi.http.interfaces;

import android.content.Context;

import com.alibaba.fastjson.JSON;
import com.dinadi.yidi.bean.FeedBackBean;
import com.dinadi.yidi.bean.LogisticsBean;
import com.dinadi.yidi.http.BaseInterface;
import com.dinadi.yidi.http.HttpListener;
import com.dinadi.yidi.http.HttpUrl;
import com.dinadi.yidi.http.ServiceUtil;
import com.dinadi.yidi.utils.algorithms.DesUtil;

import org.json.JSONException;

import java.util.HashMap;
import java.util.Map;

/**
 * author: JiaYu.He
 * Date: 2017/7/13   物流详情   不能删
 * Time: 11:03
 */
public class LogisticsInterface extends BaseInterface {
    public LogisticsInterface(Context context, HttpListener listener) {
        super(context, listener);
    }

    public void getInterface(final LogisticsBean content2, final LogisticsBean content) {
        //参数
        Map<String, String> param = new HashMap<>();
        Map<String, String> headParam = new HashMap<>();
        try {
            param.put("nu", content.getNu());
            param.put("com", content.getCom());
            headParam.put("Authorization", content2.getAuthorization());
        } catch (Exception e) {
            e.printStackTrace();
        }

        try {
            ServiceUtil.requestGetData2(HttpUrl.logisticsHost, headParam, param, new ServiceUtil.RequestCallBack<String>() {
                @Override
                public void onSuccess(String result) {

                    try {
                        listener.OnSuccess(result);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }

                }

                @Override
                public void onFailure(String error) {
                    listener.OnFail(error);

                }
            });
        } catch (JSONException e) {
            e.printStackTrace();
        }

    }

}
